{% block content %}

<h1>Configuration</h1>

<h2>This page currently doesn't do shit.</h2>

<button onclick="YAHOO.dw.newServer('SMTP');">Create New SMTP Server</button>
<button onclick="YAHOO.dw.newServer('IMAP');">Create New IMAP Server</button>

<table>
{% for srv in imapsrvs %}
<tr>
<!-- <td>{{ srv }}</td> -->
<!-- <td><a href="#" id="{{srv.id}}_edit_link" class="srv_edit_link">Edit</a></td> -->
<td>
<!--FIXME: not finished here, but I need to go out and drink-->
    <form method="get" action="/mail/config/edit/" id="{{forloop.counter0}}_edit_form">
    	<fieldset>
    	<legend>Imap Server {{forloop.counter0}}</legend>
        <label for="{{forloop.counter0}}_address">Address: </label><input type="text" id="{{forloop.counter0}}_address" name="address" value="{{srv.address}}" /><br />
        <label for="{{forloop.counter0}}_port">Port: </label><input type="text" id="{{forloop.counter0}}_port" name="port" value="{{srv.port}}" /><br />
        <label for="{{forloop.counter0}}_username">Username: </label><input type="text" id="{{forloop.counter0}}_username" name="username" value="{{srv.username}}" /><br />
        <label for="{{forloop.counter0}}_password">Password: </label><input type="password" id="{{forloop.counter0}}_password" name="password" value="{{srv.passwd}}" /><br />
        <input type="hidden" id="which" name="which" value="{{forloop.counter0}}" />
        <br />
        <button value="Save" onclick="YAHOO.dw.editServer('IMAP', '{{forloop.counter0}}_edit_form', 'SAVE'); return false;">Save</button>
        <button value="Remove" onclick="YAHOO.dw.editServer('IMAP', '{{forloop.counter0}}_edit_form', 'REMOVE'); return false;">Remove</button>
        </fieldset>
    </form>
</td>
<!-- <td><a href="#" id="{{srv.id}}_rem_link" class="srv_rem_link">Remove</a></td> -->
</tr>
{% endfor %}
</table>

{% comment %}
<!--  This section was for newforms, but hand coding worked out better -->
{% for i in iforms %}

    <form method="get" action="/mail/config/edit/" id="{{srv.id}}_edit_form">
    	<fieldset>
    	<legend>Imap Server {{srv.id}}</legend>
		{{ i.as_ul }}
		<input type="hidden" id="which" name="which" value="{{srv.id}}" />
        <br />
        <button value="Save" onclick="YAHOO.dw.saveServer('IMAP', this.parent, 'SAVE');">Save</button>
        <button value="Remove" onclick="YAHOO.dw.removeServer('IMAP', this.parent, 'REMOVE');">Remove</button>
        </fieldset>
    </form>

{% endfor %}
{% endcomment %}

{% endblock %}